 <%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link type="text/css"
	href="${pageContext.request.contextPath}/css/main.css" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"></script>
</head>
<script type="text/javascript">
function deleteOrder(id) {
	$.post("deleteOrder",{"id":id},function(data){
		if (data == "ok") {
			alert("删除成功");
			window.location.reload();
		}else {
			alert("删除失败");
			window.location.reload();
		}
	}
	);
}
</script>
<body class="main">
	<%@include file="head.jsp"%>
	<div class="dddiv"
		style="background-color: #F2F2F2; width: 1350px; height: 620px; margin-left: auto; margin-right: auto">
		<div class="dadiv" style="top: 20px;">
			<p
				style="background-color: #23262E; line-height: 40px; color: #F2F2F2;">订单记录</p>
			<div class="divbody" style="position: static; width: 1000px;">
				<form action="${pageContext.request.contextPath}/findByOrder" method="post">
				<table cellSpacing="1" cellPadding="5" width="100%" align="center"
					bgColor="#eeeeee" style="border: 1px solid #8ba7e3" border="0">
					<tr>
						<td align="center" bgColor="#f5fafe" class="ta_01">姓名：</td>
						<td class="ta_01" bgColor="#ffffff"><input type="text"
							id="name" name="name" class="bg" /></td>

						<td align="center" bgColor="#f5fafe" class="ta_01"
							style="width: 166px">手机号：</td>
						<td class="ta_01" bgColor="#ffffff" style="width: 360px"><input
							type="text" name="tel" id="tel" class="bg" /></td>
						<td align="center" bgColor="#f5fafe" class="ta_01">订单号：</td>
						<td class="ta_01" bgColor="#ffffff"><input type="number"
							name="orid" id="orid" class="bg" /></td>
					</tr>
				</table>
				
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="center" bgColor="#ffffff" class="ta_01"><br /> <br /></td>
						<td align="center" bgColor="#ffffff" class="ta_01"><input
							type="submit" name="search" value="查询" class="button_view">
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" name="reset"
							value="重置" class="button_view" /></td>
					</tr>
				</table>
				</form>
				<table cellspacing="0" cellpadding="1" rules="all"
						bordercolor="gray" border="1" id="DataGrid1"
						 style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word"	>
					<tr style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #23262E; color: #F2F2F2">
						<th align="center" width="6%">房间号</th>
						<th align="center" width="15%">姓名</th>
						<th align="center" width="15%">手机号</th>
						<th align="center" width="6%">价格</th>
						<th align="center" width="6%">订单号</th>
						<th align="center" width="22%">订单时间</th>
						<th align="center" width="6%">删除订单</th>
					</tr>
					<c:forEach items="${orders}" var="o">
						<tr onmouseover="this.style.backgroundColor = 'white'"
								onmouseout="this.style.backgroundColor = '#F5FAFE';">
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200">${o.product.roomnumber}${o.product.type }</td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200">${o.name}</td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200">${o.tel}</td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200">${o.product.price}</td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200">${o.orid}</td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200"><fmt:formatDate value='${o.ordertime}' type='date' pattern='yyyy-MM-dd HH:mm:ss'/></td>
							<td  style="CURSOR: hand; HEIGHT: 22px" align="center"
									width="200"><div class="button_view">
									<a href="#" onclick="deleteOrder(${o.orid})" id="delete_a">删除</a>
								</div></td>
						</tr>
					</c:forEach>
				</table>
			</div>
		</div>
	</div>

</body>
</html>